package adapter;

import android.support.annotation.Nullable;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;
import bean.PracticeBean;
import student.andlei.com.student.R;

public class PracticeAdapter extends BaseQuickAdapter<PracticeBean.mlist ,BaseViewHolder>{
    public PracticeAdapter(int layoutResId, @Nullable List<PracticeBean.mlist> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, PracticeBean.mlist item) {
        helper.setText(R.id.tv_title,""+item.paper_name);
        helper.setText(R.id.tv_subject,""+item.subject_name);
        helper.setText(R.id.tv_time,""+item.create_time);
        helper.setText(R.id.tv_point,item.score+"分");
        helper.addOnClickListener(R.id.bt_look_practice);
        //批改状态 0未提交 10待批改 100已批改
        switch (item.status){
            case 0:
                helper.setText(R.id.bt_look_practice,"练习");
                helper.getView(R.id.bt_look_practice).setBackgroundResource(R.drawable.bt_click);
                helper.getView(R.id.tv_point).setVisibility(View.GONE);
                break;
            case 10:
                helper.setText(R.id.bt_look_practice,"查看");
                helper.getView(R.id.bt_look_practice).setBackgroundResource(R.drawable.bt_yellow_click);
                helper.getView(R.id.tv_point).setVisibility(View.GONE);
                break;
            case 100:
                helper.setText(R.id.bt_look_practice,"查看");
                helper.getView(R.id.bt_look_practice).setBackgroundResource(R.drawable.bt_yellow_click);
                helper.getView(R.id.tv_point).setVisibility(View.VISIBLE);
                break;
        }
    }
}
